package com.jake.hunter.pattern.observer;

import com.jake.hunter.pattern.observer.impl.BinaryObserver;
import com.jake.hunter.pattern.observer.impl.DecimalObserver;
import com.jake.hunter.pattern.observer.impl.HexObserver;
import com.jake.hunter.pattern.observer.impl.OctalObserver;

import java.util.List;

public class ObserverPatternDemo {

    public static void main(String[] args) {
        NumericSubject subject = new NumericSubject();

        new HexObserver(subject);
        new OctalObserver(subject);
        new BinaryObserver(subject);
        new DecimalObserver(subject);

        List<BaseNumericObserver> observers = subject.getObservers();
        System.out.println("size: " + observers.size());

        System.out.println("First state change: 15");
        subject.setState(15);
        System.out.println("Second state change: 10");
        subject.setState(10);
    }
}
